#include <iostream>
#include <climits>
using namespace std;
int main()
{
	int target=1e9;
	long long a,b;
	long long ret=1;
	cin>>a>>b;
	while(b)
	{
		if(b&1)
		{
			b--;
			ret*=a;
		}
		else
		{
			b>>=1;
			a*=a;
		}
		if(ret<=0||ret>target)
		{
			cout<<-1<<endl;
			return 0;
		}
	}
	cout<<ret<<endl;
	return 0;
}
